fix(architecture): adapt for clean architecture#86
Closed
MayuriXx wants to merge 1 commit into
Closed
Conversation
514c7a3 to
f79e558
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




🏗️ Refactoring Clean Architecture
Context
Following an architecture review, several Clean Architecture violations were identified and fixed, along with technical improvements listed in the issue.
Changes
🔁 Renames
LocalUserService→UserService(domain/services/) — the "Local" prefix was redundant for a domain service interfaceUser(JPA entity) →UserDao(data/models/database/) — clearly distinguishes the persistence model from the domain model (UserEntity)feature/directory →features/(src/test/java/) — consistency with the.featurefiles directory (src/test/resources/features/)🆕 New files
presentation/dto/UserDTO.java— HTTP response DTO, decouples domain entities from the API contractpresentation/dto/UserRequestDTO.java— HTTP input DTO (moved fromdomain/entities/UserRequest.java)presentation/dto/UserRequestDTO.java— HTTP input DTO (moved fromdomain/entities/UserRequest.java)presentation/mappers/UserMapper.java— static mapperUserEntity→UserDTOdomain/services/UserService.java— domain service interface (replacesLocalUserService)data/models/database/UserDao.java— renamed JPA entity (replacesUser.java)data/sources/api/UserApiConfig.java— unified Retrofit configuration (mergesDummyUserApiConfig+RandomUserApiConfig)config/UseCaseConfig.java— Spring@Beandeclarations for all use cases, replacing@Serviceannotations in the domain layer✏️ Structural changes
UserRequestremoved from domain:CreateUserUseCaseandUpdateRandomUserUseCasenow accept aUserEntity(with null id); the mapping fromUserRequestDTOis handled inUserHandlerviatoUserEntity()@Serviceremoved from use cases (domain/usecases/): the domain layer no longer depends on the Spring FrameworkfilterUsers:UserService.filterUsers(UserFilter, int page, int size)usesPageRequest+JpaSpecificationExecutorto paginate directly in the database (Page<UserDao>)PageableongetRandomUsersandfilterUsers:page/sizeparameters are injected via@PageableDefault— both endpoints now return a paginatedUserResponseDTOUserDTOorUserResponseDTO🗑️ Deleted files
data/models/database/User.javadomain/entities/UserRequest.javadomain/services/LocalUserService.javadata/sources/api/dummy/DummyUserApiConfig.javadata/sources/api/randomuser/RandomUserApiConfig.java🧪 Tests
UserHandlerTest,UserServiceImplTest,UserConverterTest,UserSpecificationsTest, use cases, Cucumber)UserGetByIdContainerTestmigrated toUserDaoandUserDTO